<?php include '../public/header.php' ?>
<?php include '../public/header_index.php' ?>
<body class="laytp-container">
<div id="opt_nav">
</div>

<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3">
                        <label class="layui-form-label">流程单号</label>
                        <div class="layui-input-block">
                            <input type="text" name="sericnum" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">流程主题</label>
                        <div class="layui-input-block">
                            <input type="text" name="summary" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="enginame" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <!--                    <div class="layui-col-md3 search_hide none">-->
                    <!--                        <label class="layui-form-label">流程名称</label>-->
                    <!--                        <div class="layui-input-block">-->
                    <!--                            <div id="modeid" class="xmselect_div">-->
                    <!--                                <div class="xmselect_title">请选择</div>-->
                    <!--                            </div>-->
                    <!--                        </div>-->
                    <!--                    </div>-->
                    <input type="hidden" id="modeid" name="modeid">
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">新建时间：</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="created_at" placeholder="请选择" class="layui-input bdate_sea_range_ymd" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                                <div id="search_open" onclick="toggle_search()">
                                    <i class="layui-icon layui-icon-down"></i>展开
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <?php include '../public/bill_dao.php' ?>
            <div class="layui-col-md10" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('查看','{{d.mid}}','{{d.modenum}}')">查看</a>
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_edit('编辑','{{d.mid}}','{{d.modenum}}')">编辑</a>
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_delete('删除','{{d.id}}')">删除</a>
    </div>
</script>
<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
        <button class="layui-btn layui-btn-primary outbut" onclick="auth_but_func_add_bill()">
            <i class="layui-icon layui-icon-add-1"></i>发起申请
        </button>
    </div>
</script>
<script>

    var dao_typess = 'bill_turn';

    var sea_modeid='';
    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;

        $('#TableSearchReset').click(function () {
            sea_modeid='';
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        setSouTableExport('草稿流程');
        var mytable = table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_bill_turn_list),where: {}, page: true
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,text: TabInit.text
            ,parseData: function (res) {

                // xmselect_dan('modeid', res.data.modeidArr, sea_modeid, function (res) {
                //     if(res.arr && res.arr.length > 0){
                //         sea_modeid = res.arr[0].id;
                //     }else{
                //         sea_modeid = '';
                //     }
                //     setTimeout(function () {
                //         searchTableFunc(form, table);
                //     },100)
                // })




                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            , cols: [[
                {type: "checkbox", fixed: 'left'}
                ,{type:'numbers',title:'序号',fixed:'left'}
                ,{field: 'modename', title: '流程名称'}
                ,{field: 'sericnum', title: '流程单号'}
                ,{field: 'summary', title: '流程主题',width:450}
                ,{field: 'created_user_name', title: '发起人'}
                ,{field: 'created_at', title: '新建时间'}
                ,{field: 'status_name', title: '流程状态'}
                ,{fixed: 'right', title:'操作', toolbar: '#test-dropdown-toolbar-barDemo',align:'center',width:200}
            ]]
            , done: function (res) {
                soulTable.render(this);
            }
        });


        listTableSearch(form, table);
    });

    function auth_but_func_add_bill() {
        openPageRight('../public_flow/flow_bill_add.php', '70%');
    }
    function auth_but_func_show(buttitle, mid, modenum){
        openPage('../'+modenum+'/show.php?id='+mid);
    }

    function auth_but_func_edit(buttitle, mid, modenum){
        openPageEdit('../'+modenum+'/flow_edit.php?close=1&id='+mid);
    }


    function auth_but_func_delete(buttitle, id){
        data_delete(ask_bill_turn_del, {id:id});
    }



</script>
</body>
</html>
